import { ApiProperty, Type } from '@midwayjs/swagger'

/**
 * 结果
 */
export function ResultVO<T extends string | Type<any> | [Type<any>]>(Cls: T) {
  class Result {
    @ApiProperty({ description: '状态码', example: 200 })
    status: number

    @ApiProperty({ description: '消息', example: 'ok' })
    message: string

    @ApiProperty({ description: '数据', type: Cls, example: null })
    data: T
  }

  return Result
}
